package com.android.locationapi.maps;


import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;


public class creden extends Activity {

	
	static String usernme = null ;
	ProgressDialog myProgressDialog = null;
	  /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
    	 setRequestedOrientation(1);
    	 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.credentials);
       
        final TextView username;
        username = (TextView)this.findViewById(R.id.usr_nm_tb);     
        
        final TextView passwd;
        passwd = (TextView)this.findViewById(R.id.pass_tb);
        
        
        
        Button singinbtn = (Button)findViewById(R.id.sign_in);
        singinbtn.setOnClickListener(new OnClickListener() 
        {
        	
        	public void onClick(View v)
        	{
        		myProgressDialog = ProgressDialog.show(creden.this,"Please wait...", "Validating user...", true);
        		
        		
                
                final String strusername = username.getText().toString();
                
                usernme = strusername;
                
                
                final String strpasswd = passwd.getText().toString();
        		
        		
        		 new Thread() {
                     public void run() {
                             try{
                                     // Do some Fake-Work
                                     //sleep(500);
                                     Intent explicitIntent1 = new Intent(creden.this,serv.class);
                                     
                                     Bundle b = new Bundle();
                                     b.putString("strusername", strusername);
                                     b.putString("strpass", strpasswd);
                                     
                                     explicitIntent1.putExtras(b);  
                                     startService(explicitIntent1);
                                     
                                     
                                     
                                     
                             } catch (Exception e) { }
                             // Dismiss the Dialog
                             myProgressDialog.dismiss();
                            
                     }
             }.start();
           }
        });
    
        Button newuser = (Button)findViewById(R.id.newuser);
        newuser.setOnClickListener(new OnClickListener() 
        {
        	
        	public void onClick(View v)
        	{
        		Intent myIntent = new Intent(creden.this, displayfriends.class);
	        	creden.this.startActivity(myIntent);  		
        	}
        });
    
        
        
        
        
        
        
        
          
    }
    
      
    @Override
    public void onPause()
    {
    finish();
    super.onPause();
    }
    @Override
    public void onStop()
    {
    finish();
    super.onStop();
    }
	
}
